{% extends "base.html" %}
{% load i18n bootstrap3 dv_filters %}
{% block head_title %}{{ season.desc }}{% endblock %}

{% block container-class %}container-fluid{% endblock %}

{% block content %}
    {% include "challenge/season_header.html" with season=season only %}
    <h4>{% trans "Planning" %}</h4>
        <div class="table-avail-wrapper">
          <table class="table text-center table-avail">
            {% include "challenge/season_availability_thead.html" with wishfield=True  sessions=sessions season=season user=request.user preamble_columns=3 user_can_see_season=user_can_see_season only %}
            <tbody>
                {% for helper_category,helpers in potential_helpers %}
                    {% if helpers %}
                        <tr><th colspan="{{ sessions.count|add:"5" }}">{{ helper_category }}</th></tr>
                        {% for helper in helpers %}
                        <tr>
                            {% include "challenge/season_availability_partial_helper_columns.html" with helper=helper availabilities=availabilities only %}
                            {{ availabilities|userplanning_sessions_readonly:helper }}
                        </tr>
                        {% endfor %}
                        {% if helpers.count > 10 %}
                            {% include "challenge/season_availability_partial_head.html" with sessions=sessions season=season user=request.user preamble_columns=3 only %}
                        {% endif %}
                    {% endif %}
                {% endfor %}
            </tbody>
          </table>
        </div>

<div class="hidden-print">
</div>
<div class="hidden-print">
  <a class="btn btn-default" href="{% dv_season_url season.begin %}">{% blocktrans with year=season.year %}Mois de {{ year }}{% endblocktrans %}</a>

  <div class="btn-group" role="group" aria-label="exports">
    {% if season.dv_season %}
      {% include 'export_buttons.html' with exporturl='season-personal-planning-export' year=season.year season=season.dv_season exportargs=helperpk filter_querystring=filter_querystring only %}
    {% else %}
      {% include 'export_buttons.html' with exporturl='season-personal-planning-export' seasonpk=season.pk exportargs=helperpk filter_querystring=filter_querystring only %}
    {% endif %}
    {% if season.dv_season %}
      <a class="btn btn-info btn-sm" title="{% blocktrans %}Calendrier{% endblocktrans %}" href="{% url "season-personal-calendar" season.year season.dv_season helperpk %}">
    {% else %}
      <a class="btn btn-info btn-sm" title="{% blocktrans %}Calendrier{% endblocktrans %}" href="{% url "season-personal-calendar" season.pk helperpk %}">
    {% endif %}
      <span class=" glyphicon glyphicon-calendar" aria-hidden="true"></span>
      {% trans "ics" %}
    </a>
  </div>
</div>
{% endblock %}
